/*******************************************************************************
 * Copyright (c) 2008 Sylvain Sicard.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Sylvain Sicard - initial API and implementation
 ******************************************************************************/
package fr.jade.fraclite.orb.names;

import fr.jade.fraclite.orb.api.Binder;
import fr.jade.fraclite.orb.api.Name;

public class AbstractName implements Name {

  private static final long serialVersionUID = 1L;

  protected long itfId;
  
  protected String signature;
  
  protected transient Binder naming;
  
  public AbstractName(long itfId, String signature, Binder naming){
    this.itfId = itfId;
    this.signature = signature;
    this.naming = naming;
  }
  
  @Override
  public boolean equals(Object o){
    if(o instanceof TcpIpName){
      return ((TcpIpName)o).getNaming().equals(naming) &&
             ((TcpIpName)o).getItfId() == itfId;
    }else{
      return false;
    }
  }

  public long getItfId() {
    return itfId;
  }

  public String getSignature(){
    return signature;
  }
  
  public Binder getNaming() {
    return naming;
  }
  
  public void setNaming(Binder naming){
    this.naming = naming;
  }
  
  public String toString(){
    return itfId+"::"+signature;
  }
}
